import pymysql

# 1.连接MySQL
conn = pymysql.connect(host="127.0.0.1", port=3306, user="root", password="123456", charset="utf8mb4", db="zzm")
cursor = conn.cursor(cursor=pymysql.cursors.DictCursor)

# cursor.execute("delete from admin where id=%s", [3, ])
# 第二种写法
cursor.execute("delete from admin where username = '李四' ")
conn.commit()
# 3.关闭
cursor.close()
conn.close()
# 在进行新增，删除，修改时，一定要记得commit，不然数据库没有数据
# cursor.execute("...")
# conn.commit()
